Get the Photon Player GameObject

71

Get the Photon Player GameObject -

var photonViews = UnityEngine.Object.FindObjectsOfType<PhotonView>();
foreach (var view in photonViews)
{
    var player = view.owner;
    //Objects in the scene don't have an owner, its means view.owner will be null
    if(player!=null){
        var playerPrefabObject = view.gameObject;
        //do works...
   }
}

Comments

Submit
0 Comments